[IPhone] How to get the lenth of each line of the text when wordwrap is considered.

Posted by semix on Stack Overflow See other posts from Stack Overflow or by semix
Published on 2010-04-26T07:39:33Z Indexed on 2010/04/26 7:43 UTC
Read the original article Hit count: 261

Filed under:
|
|

Hi there. I meet a problem as follows: I have a NSString displayed in a UILabel into multiple lines with WordWrap mode = UILineBreakModeWordWrap, rendered into 2 lines NSString* myText = @"I am here Work".

"I am here_" //Line 1. _ is for blank. "Work" //Line 2.

Is there anyway for me to get the width for the substring 'I am here'? and also for 2nd line 'Work'

If that's hard, How can I know which part of the whole string is in line 1? and which part is in line 2?

thanks in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about wordwrap